import request from '@/utils/request'

export function permissionTree(query) {
  return request({
    url: '/api/admin/permission/tree',
    method: 'get',
    params: query
  })
}

export function permissionAdd(data) {
  return request({
    url: '/api/admin/permission/add',
    method: 'post',
    data
  })
}

export function permissionEdit(data) {
  return request({
    url: '/api/admin/permission/update',
    method: 'put',
    data
  })
}

export function permissionDel(id) {
  return request({
    url: '/api/admin/permission/delete/' + id,
    method: 'delete',
    // params: {
    //   id
    // }
  })
}

export function fetchProduct(id) {
  return request({
    url: `/products/${id}`,
    method: 'get'
  })
}


export function updateProduct(id, data) {
  return request({
    url: `/products/${id}`,
    method: 'put',
    data
  })
}

export function deleteProduct(id) {
  return request({
    url: `/products/${id}`,
    method: 'delete'
  })
}